<!DOCTYPE html>
<html>
<head>
<!-- <base href="http://localhost:8080/StudentSys/">   -->
<meta charset="UTF-8">
<title>登录页面</title>
<!-- link : 表示连接，在当前页面中引用其他文件的的标签 -->
<link type="text/css" rel="stylesheet" href="css/login.css">
<script type="text/javascript" src="js/jquery-3.1.1.js"></script>
<script type="text/javascript">
	function examine(){
		let username = $('#username').val();											//获取账号输入框的值
		let password = $('#password').val();											//获取密码输入框的值
		if(username.length > 0 && password.length > 0){									//判断账号密码是否输入为空
			$.get("login.do?username="+username+"&password="+password, function(result){//发起异步请求
				if(result){																//请求有数据
					//将地址跳转到首页	
					window.location.href = "index.html";								//则跳转到首页
				}else{
					alert("账号或者密码错误");
				}
			});
		}else{
			alert("用户名或密码不能为空");
		}
	}
</script>
</head>


<body>
	<div class="in">
		<h2>登&nbsp;&nbsp;&nbsp;&nbsp;录</h2>
		<form action="login.do" id="form" method="post">
			<div class="item">
				<span>账号:</span>
				<input type="text" name="username" id="username" value="">
			</div>
			<div class="info" id="info">
				
			</div>
			<div class="item">
				<span>密码:</span>
				<input type="password" name="password" id="password" value="">
			</div>
			<div class="btn">
				<input type="checkbox" name="save" value="user" id="save">
				<label for="save">记住密码</label>
				<a href="#">忘记密码?</a>
			</div>
			
			<div class="item">
				 <!-- 设置点击这个超链接后，不再跳转页面而是执行JS函数  -->
				<a href="javascript: examine();">登 录</a> 
				
			</div>
		</form>
	</div>
</body>
</html>




